﻿using WidgetsDesign.API.Models;

namespace WidgetsDesign.API.Services
{
    public interface IUserRepository
    {
        /// <summary>
        /// 获取随机数
        /// </summary>
        /// <param name="length">长度</param>
        /// <returns></returns>
        string GetRandomVerificationCode(int length=4);

        Task CreateVerificationCode(VerificationCodeModel verificationCode);
        void CreateUserInfo(UserInfo userInfo);
        Task<UserInfo?> GetUserInfoByPhoneNumber(string phoneNumber);
        Task<UserInfo?> GetUserInfoByEmail(string email);
        Task<UserInfo?> GetUserInfoById(int id);
        Task<UserInfo?> GetUserInfoByUuid(Guid id);
        Task  ResetPassword(string email,string password);
        Task  UpdateUserName(Guid uuid ,string name);
        Task UploadAvatar(Guid UserId,string avatarUrl);
        //Task<int> QueryTodayVerificationCodeCount(string phoneNumber, string type);

        /// <summary>
        /// 验证 验证码 是否有效
        /// </summary>
        /// <param name="email">邮箱</param>
        /// <param name="code">验证码</param>
        /// <returns>0 成功 1 未找到 2超时</returns>
        Task<int> ValidateVerificationCode(string email, int code);
        void UpdateWallet(int id, double value);
        Task<bool> SaveAsync();
    }
}
